<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link rel="shortcut icon" href="<!--{eval echo register_static('img/touch-icon-57x57.png');}-->">

    <title>粉粉管理系统</title>

    <!-- Bootstrap core CSS -->
    <link href="<!--{eval echo register_static('css/bootstrap.min.css');}-->" rel="stylesheet">
    <link href="<!--{eval echo register_static('css/bootstrap-reset.css');}-->" rel="stylesheet">

    <!--Animation css-->
    <link href="<!--{eval echo register_static('css/animate.css');}-->" rel="stylesheet">

    <!--Icon-fonts css-->
    <link href="<!--{eval echo register_static('assets/font-awesome/css/font-awesome.css');}-->" rel="stylesheet" />
    <link href="<!--{eval echo register_static('assets/ionicon/css/ionicons.min.css');}-->" rel="stylesheet" />

    <link href="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.min.css');}-->" rel="stylesheet">

    <!-- Plugins css -->
    <link href="<!--{eval echo register_static('assets/modal-effect/css/component.css');}-->" rel="stylesheet">

    <!-- DataTables -->
    <link rel="stylesheet" href="<!--{eval echo register_static('assets/datatables/jquery.dataTables.min.css" rel="stylesheet');}-->" />

    <!-- Custom styles for this template -->
    <link href="<!--{eval echo register_static('css/style.css');}-->" rel="stylesheet">
    <link href="<!--{eval echo register_static('css/helper.css');}-->" rel="stylesheet">

    <!-- My styles for this template -->
    <link href="<!--{eval echo register_static('css/common.css');}-->" rel="stylesheet">

</head>

<body>

<!-- Aside Start-->
<!--{template admin_v2/leftside}-->
<!-- Aside Ends-->


<!--Main Content Start -->
<section class="content">

    <!-- Header -->
    <!--{template admin_v2/header}-->
    <!-- Header Ends -->


    <!-- Page Content Start -->
    <!-- ================== -->

    <div class="wraper container-fluid diarys">
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">文章列表</h3>
                    </div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-md-5 col-sm-5 col-xs-5" id="addDiaryToHotReady">
                                <!-- Search -->
                                <form class="form-inline" role="form" action="admin.php?ac=article_class&op=getUserArticleList" method="post" style="float:left;">
                                    <div class="form-group">
                                        <input type="text" class="form-control"  placeholder="输入作者UID" name="uid" value="{$suid}">
                                    </div>
                                    <button type="submit" class="btn btn-success m-l-10">点击搜索</button>
                                </form>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-md-12 col-sm-12 col-xs-12">
                                <table id="datatable" class="table table-striped table-bordered">
                                    <thead>
                                    <tr>
                                        <th style="width: 5%;">类型</th>
                                        <th style="width: 10%;">作者</th>
                                        <th style="width: 15%;">文章标题</th>
                                        <th style="width: 60%;">文章概要</th>
                                        <th>文章Action</th>
                                        <th style="width: 10%;">操作</th>
                                    </tr>
                                    </thead>

                                    <tbody>
                                    <!--{loop $list $article}-->
                                    <tr  id="tr_{$article['id']}">
                                        <td><span class="btn btn-info btn-xs m-b-5">$article[category]</span></td>
                                        <td><a href="" class="btn btn-info btn-xs m-b-5" target="_blank">{$article[user][nickname]}</a></td>
                                        <td>
                                            <a href="admin.php?ac=article_class&op=getArticleInfo&uid={$article[uid]}&aid={$article[aid]}" target="_blank">{$article[title]}</a>
                                        </td>
                                        <td>
                                            {$article[summary]}
                                        </td>
                                        <td>pinksns://article/info?aid={$article['aid']}&author_uid={$article['user']['uid']}</td>
                                        <td class="actions">
                                            <div class="btn-group">
                                                <button type="button" class="btn btn-success dropdown-toggle btn-sm" data-toggle="dropdown" aria-expanded="true">管理 <span class="caret"></span></button>
                                                <ul class="dropdown-menu" role="menu">
                                                    <li><a href="javascript:;" data-bodyid="{$article[diaryId]}" data-topicid="$article['topics'][0]['id']" class="addHotDiary">加入话题热门点滴</a></li>
                                                </ul>
                                            </div>
                                            <a href="javascript:;"  class="on-default remove-row btn btn-default btn-sm" data-aid="{$article[aid]}" data-uid="{$article[uid]}" data-id="{$article[id]}"><i class="fa fa-trash-o"></i></a>
                                        </td>
                                    </tr>
                                    <!--{/loop}-->
                                    </tbody>
                                </table>
                                <!--{if $pageUrl}-->
                                <div class="row">
                                    <div class="col-md-12">
                                        <form action="admin.php" method="get">
                                            <div class="input-group m-t-10 col-md-2" style="margin: 0 auto">
                                                <input type="hidden" name="ac" value="article_class">
                                                <input type="hidden" name="op" value="getArticleList">
                                                <div id="spinner4">
                                                    <div class="input-group">
                                                        <div class="spinner-buttons input-group-btn">
                                                            <button type="button" class="btn spinner-down btn-pink">
                                                                <i class="fa fa-minus"></i>
                                                            </button>
                                                        </div>
                                                        <input type="text" name="page" class="spinner-input form-control" maxlength="4"  value="{$pageUrl['currentPage']}">
                                                        <div class="spinner-buttons input-group-btn">
                                                            <button type="button" class="btn spinner-up btn-purple">
                                                                <i class="fa fa-plus"></i>
                                                            </button>
                                                        </div>
                                                    </div>
                                                </div>
                                                <span class="input-group-btn"><button type="submit" class="btn btn-effect-ripple btn-primary">跳转</button></span>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                                <ul class="pager">
                                    <li>
                                        <a href="{$pageUrl['prev']}"> <i class="fa fa-angle-double-left"></i>上一页</a>
                                    </li>
                                    <li>
                                        <a href="{$pageUrl['first']}"> <i class="fa"></i>第一页</a>
                                    </li>

                                    <!--<li>-->
                                    <!--<a href="javascript:;"> <i class="fa"></i>当前为{$pageUrl['currentPage']}页，共{$pageUrl['totalPage']}页</a>-->
                                    <!--</li>-->
                                    <li>
                                        <a href="{$pageUrl['next']}">下一页 <i class="fa fa-angle-double-right"></i> </a>
                                    </li>
                                </ul>
                                <!--{/if}-->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
    <!-- Page Content Ends -->
    <!-- ================== -->

    <div id="con-close-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">

    </div><!-- /.modal -->


    <!-- Footer Start -->
    <!--{template admin_v2/footer}-->
    <!-- Footer Ends -->



</section>
<!-- Main Content Ends -->


<!-- js placed at the end of the document so the pages load faster -->
<script src="<!--{eval echo register_static('js/jquery.js');}-->"></script>
<script src="<!--{eval echo register_static('js/bootstrap.min.js');}-->"></script>
<script src="<!--{eval echo register_static('js/pace.min.js');}-->"></script>
<script src="<!--{eval echo register_static('js/wow.min.js');}-->"></script>
<script src="<!--{eval echo register_static('js/jquery.nicescroll.js');}-->" type="text/javascript"></script>
<script type="text/javascript" src="<!--{eval echo register_static('assets/spinner/spinner.min.js');}-->"></script>
<script src="<!--{eval echo register_static('js/jquery.app.js');}-->"></script>
<script src="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.min.js');}-->"></script>
<script src="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.init.js');}-->"></script>

<script type="text/javascript">
    $(document).on("click",".remove-row",function(){
        var data = $(this).data();
        var id = data.id;
        var aid = data.aid;
        var uid = data.uid;
        var tritem = 'tr_'+id;
//        alert(id);return;
        $.ajax(
                {
                    url     :   "admin.php?ac=article_class&op=deleteArticle",
                    type    :   "POST",
                    data    :   {uid : uid , aid : aid },
                    success :   function(data)
                    {
//                        alert(data);
                        if (data == 1) {
//                            $("#"+tritem).hide();
                            swal("删除成功!", "操作成功！", "success");
                        }else{
                            swal("删除失败!", "操作失败！", "error");
                        }
                        refresh();
                    }
                });

    });

    $(document).off('#search').on('click','#search',function(){
        var uid = $('#uid').val();
        alert(uid);return
        var reasonType = $('#reasonType').val();
        reasonType != 'no' ? _Where_.reasonType = reasonType : _Where_.reasonType = undefined;
        RequestList();

    });

    //设置话题精选点滴
    $(document).on('click','.addHotDiary',function(){
        var bodyId=$(this).data('bodyid');
        var topicId=$(this).data('topicid');
        var score=0;

        $.get(
            'admin.php?ac=manage&op=setTopicHotDiaryCache&bodyId='+bodyId+'&topicId=' + topicId + '&score='+score,
            {},
            function(r){
                if(!r) {
                    alert('操作失败');
                    return;
                };
                alert('操作成功');
                location.reload();
            }
        );

    })

    $('#spinner4').spinner({value:0, step: 1, min: 1, max: 200});

    // 刷新当前页面
    function refresh(){
        setInterval(window.location.reload(),5000);
    }
</script>
</body>
</html>
